package com.linapex.models;

/**
 * 实体对象
 * @author 杨华明
 * @date 2012-10-24
 */
public class User {
	private int id;
	private String code;
	private String description;
	private String name;
	private Integer sex;
	
	public void init(){
		if(code==null||code.trim().length()<=0) code="-1";
		if(name==null||name.trim().length()<=0) name="-1";
		if(sex==null) sex=-1;
	}
	/**用户账号*/
	public String getCode() {
		return code;
	}
	/**用户账号*/
	public void setCode(String code) {
		this.code = code;
	}
	/**用户ID*/
	public int getId() {
		return id;
	}
	/**用户ID*/
	public void setId(int id) {
		this.id = id;
	}
	/**用户名*/
	public String getName() {
		return name;
	}
	/**用户名*/
	public void setName(String name) {
		this.name = name;
	}
	/**性别(1=男、0=女)*/
	public Integer getSex() {
		return sex==null?0:sex;
	}
	/**性别(0=女/1=男)*/
	public String getSexName() {
		return getSex()==0?"女":"男";
	}
	
	/**性别(0=女/1=男)*/
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	public User(int id, String name, Integer sex) {
		super();
		this.id = id;
		this.name = name;
		this.sex = (sex==null?0:sex);
	}

	public User() {
		super();
	}
	/**个人说明*/
	public String getDescription() {
		return description;
	}
	/**个人说明*/
	public void setDescription(String description) {
		this.description = description;
	}
	@Override
	public String toString() {
		return "User [id=" + id + ", code=" + code + ", description="
				+ description + ", name=" + name + ", sex=" + sex + "]";
	}
}
